<!-- 预测明细 -->
<template>
  <div class="table w1021">
    <div class="tableTab">
      <span class="tableBtn" :class="type=='income'?'on':''" @click="type='income'">每股收益(元)</span>
      <span class="tableBtn" :class="type=='rmb'?'on':''" @click="type='rmb'">净利润(万元)</span>
    </div>
    <div class="tableTh tableTr flex" v-if="type=='income'">
      <span class="tableTd w350">每股收益(首个预测年份)</span>
      <span class="tableTd w350">每股收益(第二个预测年份)</span>
      <span class="tableTd w350">每股收益(第三个预测年份)</span>
    </div>
    <div class="tableTh tableTr flex" v-else>
      <span class="tableTd w350">营业收入(首个预测年份)</span>
      <span class="tableTd w350">营业收入(第二个预测年份)</span>
      <span class="tableTd w350">营业收入(第三个预测年份)</span>
    </div>
    <div>
      <div
        class="tableTr tableBody top flex"
        v-for="(item,index) in data"
        :key="index"
        v-if="type=='income'"
      >
        <span class="orange tableTd w350">{{item.epsP1|filterVal}}</span>
        <span class="orange tableTd w350">{{item.epsP2|filterVal}}</span>
        <span class="orange tableTd w350">{{item.epsP3|filterVal}}</span>
      </div>
    </div>
    <div>
      <div
        class="tableTr tableBody top flex"
        v-if="type!='income'"
        v-for="(item) in data"
        :key="item.id"
      >
        <span class="orange tableTd w350">{{item.salesP1|filterVal("number")}}</span>
        <span class="orange tableTd w350">{{item.salesP2|filterVal("number")}}</span>
        <span class="orange tableTd w350">{{item.salesP3|filterVal("number")}}</span>
      </div>
    </div>
    <div class="tableNone orange w1021 top" v-if="data.length==0">暂无数据</div>
  </div>
</template>

<script>
import { number } from "../../script/api";
export default {
  data() {
    return {
      type: "income"
    };
  },
  props: ["data"],
  filters: {
    filterVal(ops, num) {
      if (typeof ops == "number") {
        return number(ops, num);
      }
      return ops ? ops : "--";
    }
  },
  components: {},
  computed: {},
  mounted() {},
  methods: {}
};
</script>
<style lang='scss' scoped>
</style>